<template>
	<div id="app">
    <router-view></router-view>
		<main-tab-bar></main-tab-bar>
	</div>
</template>

<script>
  import MainTabBar from "./components/content/MainTabBar";

	export default {
		name: 'App',
		data() {
			return {
				userId: '12345',
				imgUrl: 'http://www.baidu.com',
			}
		},
		methods: {
			profileClick() {
				this.$router.push({
					path: '/profile',
					query: {
						name: "Tom",
						sex: "male"
					}
				})
			},
			add() {
				this.$store.commit("increment")
			},
			sub() {
				this.$store.commit("decrement")
			}
		},
		components: {
		  MainTabBar
		}
	}

	// promise
	new Promise((resolve, reject) => {
		setTimeout(() => {
			resolve("hello promise")

			reject("hello error")
		}, 1000)
	}).then((data) => {
		console.log("第一个then")
		console.log(data)
	}).catch((error) => {
		console.log(error)
	}).then(() => {
		console.log("第二个then")
	}).then(() => {
		console.log("第三个then")
	})


	Promise.all([
		new Promise((resolve, reject) => {
			setTimeout(() => {
				console.log("请求1")
				resolve()
			}, 1000)
		}),
		new Promise((resolve, reject) => {
			setTimeout(() => {
				console.log("请求2")
				resolve()
			}, 3000)
		}),
	]).then(() => {
		console.log("promise all success")
	}).catch(() => {
		console.log("promise all error")
	})

</script>

<style>
	@import "./assets/css/base.css";
</style>
